package numbers;

import java.math.BigInteger;

/**
 * @author Lucas
 *
 */
public class IntToByte {
	public static final byte[] intToByteArray(int value) {
        return new byte[] {
                (byte)(value >>> 24),
                (byte)(value >>> 16),
                (byte)(value >>> 8),
                (byte)value
                };
	}
	
	public void run(){
		int start = 1234567;
		byte[] conv = intToByteArray(start);
		BigInteger bi = new BigInteger(conv);
		System.out.println(Integer.toBinaryString(start));
		System.out.println( bi.toString(2) );
	}
	
	public static void main(String[] args){
		IntToByte itob = new IntToByte();
		itob.run();
	}
}
